﻿<%@ Page Title="" MasterPageFile="~/BackOffice.master" Language="C#" AutoEventWireup="true" CodeBehind="CadastroCategoria.aspx.cs" Inherits="MakeIT.Deo.Apresentacao.CadastroCategoria" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<asp:Content ID="cMain" ContentPlaceHolderID="cphMain" runat="server">
    <div class="art-Block">
        <div class="art-Block-body">
            <div class="art-BlockHeader">
                <div class="l"></div>
                <div class="r"></div>
                <div class="art-header-tag-icon">
                    <div class="t">Cadastro de Categorias</div>
                </div>
            </div>
            <div class="art-BlockContent">
                <div class="art-BlockContent-tl"></div>
                <div class="art-BlockContent-tr"></div>
                <div class="art-BlockContent-bl"></div>
                <div class="art-BlockContent-br"></div>
                <div class="art-BlockContent-tc"></div>
                <div class="art-BlockContent-bc"></div>
                <div class="art-BlockContent-cl"></div>
                <div class="art-BlockContent-cr"></div>
                <div class="art-BlockContent-cc"></div>
                <div class="art-BlockContent-body">

    
            <asp:TabContainer ID="tabCategoria" runat="server" ActiveTabIndex="1">
                <asp:TabPanel ID="tabPesquisa" runat="server" HeaderText="Pesquisa">
                    <ContentTemplate>
                        <div style="width: 98%;">
                            <table style="width: 100%;">
                                <tr>
                                    <td>
                                        C&oacute;digo
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtId" runat="server"></asp:TextBox>
                                        <asp:MaskedEditExtender ID="mskTxtId" runat="server" Mask="9999999" TargetControlID="txtId" PromptCharacter="" />
                                    </td>
                                    <td>
                                        Categoria
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtCategoria" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        <asp:Button ID="btnPesquisa" runat="server" Text="Pesquisa" OnClick="btnPesquisa_Click" />
                                        <br />
                                        <br />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        <asp:GridView ID="grvResultado" runat="server" AutoGenerateColumns="False" EmptyDataText="N&atilde;o foram encontrados registros nessa pesquisa!">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:ImageButton ID="imgbVisualizar" runat="server" OnClick="imgbVisualizar_Click"
                                                            ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" CommandArgument='<%#Eval("IdCategoria") %>' />
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Center" />
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="IdCategoria" HeaderText="ID" />
                                                <asp:BoundField DataField="Categoria" HeaderText="Categoria" />
                                            </Columns>
                                        </asp:GridView>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="tabCadastro" runat="server" HeaderText="Cadastro">
                    <ContentTemplate>
                        <asp:Panel ID="panelCad" runat="server">
                            <div style="width: 98;">
                                <table style="width: 100%;">
                                    <tr>
                                        <td>
                                            C&oacute;digo:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtCadId" runat="server" Enabled="False"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Categoria:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtCadCategoria" runat="server" Width="200px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCadCategoria"
                                                ErrorMessage="*" ValidationGroup="Salvar" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align:top;">
                                            Data Cadastro:
                                        </td>
                                        <td>
                                            <asp:Literal ID="ltDataCadastro" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align:top;">
                                            Cadastrado por:
                                        </td>
                                        <td>
                                            <asp:Literal ID="ltCadastradoPor" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align:top;">
                                            Data Edi&ccedil;&atilde;o:
                                        </td>
                                        <td>
                                            <asp:Literal ID="ltDataEdicao" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align:top;">
                                            Editado por:
                                        </td>
                                        <td>
                                            <asp:Literal ID="ltEditadoPor" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <span style="color:Red;"> (*) Campos Obrigatórios </span><br />
                                            <br />
                                            <br />
                                            <asp:Button ID="btnSalvar" runat="server" Enabled="False" 
                                                OnClick="btnSalvar_Click" Text="Salvar"  ValidationGroup="Salvar"/>
                                            &nbsp;<asp:Button ID="btnCancelar" runat="server" OnClick="btnCancelar_Click" 
                                                Text="Cancelar" />
                                             <asp:Button ID="btnEditar" runat="server" Enabled="False" 
                                                OnClick="btnEditar_Click" Text="Editar" />
                                            &nbsp;<asp:Button ID="btnExcluir" runat="server" Enabled="False" 
                                                OnClick="btnExcluir_Click" Text="Excluir" />
                                            &nbsp;<asp:Button ID="btnNovo" runat="server" OnClick="btnNovo_Click" Text="Novo" />
                                            <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnExcluir" ConfirmText="Confirma a exclus&atilde;o da categoria?">
                                            </asp:ConfirmButtonExtender>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="TabPanelFoto" runat="server" HeaderText="Imagens">
                    <ContentTemplate>
                       <asp:Panel ID="panelCadFoto" runat="server">

                            <table width="100%">
                                <tr>
                                    <td align="center" bgcolor="#CCCCCC">
                                        Upload de Imagens
                                    </td>
                                    <td align="center" bgcolor="#CCCCCC">
                                        Categoria: <asp:Label ID="LabelIdCategoria" runat="server"></asp:Label>&nbsp;-&nbsp;
                                        <asp:Label ID="LabelCategoria" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Enviar Arquivo:
                                    </td>
                                    <td>
                                        <asp:FileUpload ID="FileUpload1" runat="server" Width="300" />&nbsp;
                                        <asp:Button ID="ButtonEnviar1" runat="server" Text="Enviar" OnClick="ProcessUploadImagem" ValidationGroup="Salvar"/>
                                        <asp:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="ButtonEnviar1" ConfirmText="Confirma o envio da imagem?">
                                        </asp:ConfirmButtonExtender>
                                </tr>

                                <tr>
                                    <td colspan="2">
                                        <asp:Label ID="LabelMensagem" runat="server" Text=""></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:GridView ID="grvImagens" runat="server" AutoGenerateColumns="False" EmptyDataText="">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:ImageButton ID="imgbExcluir" runat="server" OnClick="imgbExcluir_Click"
                                                            ImageUrl="~/App_Themes/Padrao/imagens/backoffice/excluir.gif" CommandArgument='<%#Eval("idCategoriaFoto") %>' />
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Center" />
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="IdCategoriaFoto" HeaderText="ID"/>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:TextBox ID="tbOrdem" runat="server" Columns="10" Enabled="false"
                                                            Text='<%# DataBinder.Eval(Container.DataItem, "Ordem").ToString()%>'> </asp:TextBox>
                                                        <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" 
                                                            ClearTextOnInvalid="True" ErrorTooltipEnabled="true" AutoComplete="False"
                                                            ClearMaskOnLostFocus="True" 
                                                            InputDirection="RightToLeft" Mask="999,999,999" MaskType="Number" 
                                                            PromptCharacter="_" TargetControlID="tbOrdem" >
                                                        </asp:MaskedEditExtender>
                                                    </ItemTemplate>
                                                    <HeaderTemplate>Ordem</HeaderTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="Nome" HeaderText="Nome" />
                                                <asp:BoundField DataField="Mime" HeaderText="Tipo" />
                                            </Columns>
                                        </asp:GridView>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </ContentTemplate>                
                </asp:TabPanel>
            </asp:TabContainer>


                </div>
            </div>
        </div>
    </div>


</asp:Content>




